Add LocalOutlierFactor to cuml.neighbors - #8554
Draft
JulienAu wants to merge 1 commit into
Draft
Conversation
LOF is computed as pure Python post-processing of the GPU neighbor search from cuml.neighbors.NearestNeighbors: k-distance, reachability, local reachability density, then the density ratio. Both sklearn modes are supported, outlier detection and novelty detection, with the same mode guards. Self-neighbor removal handles exact duplicates, where the sample is not guaranteed to come back first in the tied block. Signed-off-by: JulienAu <16043912+JulienAu@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #8504.
Implements LocalOutlierFactor as Python post-processing on top of cuml.neighbors.NearestNeighbors, as discussed in the issue. Both sklearn modes are covered: outlier detection (fit_predict, negative_outlier_factor_, offset_ with contamination handling) and novelty detection (predict, decision_function, score_samples), with the same mode guards as sklearn.
Correctness: 18 tests against sklearn across dtypes, n_neighbors values, both modes, exact duplicates (the self-removal path handles the case where a sample does not come back first in its own neighbor list), contamination validation and pickling. All pass on GPU against the nightly wheel. From the issue prototype: 100k x 16 fits in 2.5 s against 27 s for sklearn with n_jobs=-1, on a GTX 1650 Ti.
Scoped to what the existing NearestNeighbors primitive supports; cuml.accel support is a follow-up per the issue discussion. One question for review: should InteropMixin land now or together with the accel follow-up?